package com.epoint.pjq;

import android.app.Application;

import com.epoint.pjq.core.crash.CrashHandler;

public class MyApplication extends Application {
	
	private static Application instance;

	public MyApplication() {
	}

	public static synchronized void initializeInstance(Application application) {
		if (instance == null)
			instance = application;
	}

	public static synchronized Application getInstance() {
		if (instance == null)
			throw new IllegalStateException();
		else
			return instance;
	}

	public void onCreate() {
		super.onCreate();

		initializeInstance(this);

		// 异常处理，不需要处理时注释掉这两句即可！
		CrashHandler crashHandler = CrashHandler.getInstance();
		// 注册crashHandler
		crashHandler.init(this);
	}

}